<template>
  <div class="about_us_sb">
    <!-- 左公司简介 右发展历程 -->
    <div class="companyProfile_devHistory">
      <div class="ql-editor company_profile" v-html="companyProfile" :style="{background:`url(${InformationPanelImage})`}"/>
      <div class="dev_history">
        <div class="title">发展历程</div>
        <div class="info">
          <el-timeline reverse>
            <el-timeline-item v-for="(historys, key) in devHistoryMap" :key="'history_item_'+key" placement="top" :timestamp="`${key}年`" :icon="dev_history_icons[randomNum(10)]" color="#67C23A" size="large">
              <Card class="history" v-for="history in historys" border-radius="1rem" height="auto">
                <span class="history--title">{{history.title}}</span>
                <span class="history--date">{{history.date}}</span>
                <span class="history--info">{{history.info}}</span>
              </Card>
            </el-timeline-item>
          </el-timeline>
        </div>
      </div>
    </div>
    <marquee direction="right" behavior="alternate" align="right" width="50%" hspace="10" vspace="10"
             onMouseOut="this.start()" onMouseOver="this.stop()"
             class="company_honor">
      <image-preview v-for="honor in companyHonor" :src="honor.photoUrl" width="13rem" height="14rem" class="photo"/>
    </marquee>
  </div>
</template>

<script>

import {get_about_us_data} from "@/api";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import {parseTime} from "@/utils/zzDouUtils/dateUtil";
import {randomNum} from "@/utils/zzDouUtils/numUtil";

export default {
  name: "Jiayi_about_us",
  components: {},
  computed: {
  },
  data() {
    return {
      doc: {
      },
      paperImage: require("@/assets/images/paper.jpg"),
      InformationPanelImage: require("@/assets/images/Information_panel.png"),
      companyProfile: null,
      devHistory: null,
      companyHonor: null,
      devHistoryMap:{}
    };
  },
  watch: {},
  mounted() {

  },
  created() {
    this.getAboutUsData();
  },
  methods: {
    randomNum,
    getAboutUsData(){
      get_about_us_data().then(response=>{
          this.companyProfile = response.companyProfile;
          this.devHistory = response.devHistory;
          this.parseMap();
          this.companyHonor = response.companyHonor;
      })
    },
    parseMap(){
      this.devHistoryMap = {};
      this.devHistory.forEach( v =>{
        let dateTime = parseTime(v.date,'{y}')
        let datas = this.devHistoryMap[dateTime];
        if (!datas){
          datas = []
        }
        datas.push(v)
        this.devHistoryMap[dateTime] = datas;
      })
    }
  }
};
</script>

<style scoped>
[v-cloak] {
  display: none;
}
.about_us_sb{
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
}
.companyProfile_devHistory{
  width: 85%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.company_profile{
  width: 70%;
  margin: 0 auto;
  border-radius: 0.5rem;
  /*font-family: 'xiangfengyizuishiqianyuan' !important;*/
}
.dev_history{
  width: 30%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
  overflow: hidden;

  .title{
    width: 100%;
    height: 10%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.8rem;
  }
  .info{
    padding-top: 5%;
  }
}
.history{
  margin-top: 10px;
  padding: 0.2rem;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: start;

  .history--title{
    padding: 0.1rem;
    font-size: 1.2rem;
    font-weight: bold;
  }
  .history--date{
    padding: 0.2rem;
    font-size: 0.7rem;
    font-weight: bold;
  }
  .history--info{
    padding: 0.2rem;
    font-size: 0.9rem;
  }
}
/deep/.el-timeline-item__node--large{
  left: -0.7rem !important;
  top: -0.5rem !important;
  font-size: 1.5rem !important;
  width: 2rem !important;
  height: 2rem !important;
}
/deep/.el-timeline-item__timestamp{
  font-size: 1rem;
  font-weight: bold;
  color: #000;
  background-color: #88d4a0;
  width: 7rem;
  height: 1.4rem;
  text-align: center;
  border-radius: 3rem;
}

.company_honor{
  width: 100%;
  height: 20vh;
  display: flex;
  flex-direction: row;
  justify-content: start;
  align-items: center;
  overflow: scroll;

  .photo{
    margin-right: 2rem;
    display:inline-block;
    flex-shrink: 0;
    animation: left 40s linear infinite;
  }
}

/*滚动条整体样式*/
::-webkit-scrollbar {
  display: none;
}

@font-face {
  font-family: 'xiangfengyizuishiqianyuan';
  src: url('../../assets/font/xiangfengyizuishiqianyuan.ttf'),
}

/*------- 响应式布局 -------*/
/* 手机（小屏幕） */
@media (width <= 992px) {
  html{
    font-size: 14px;
  }
  .dev_history{
    display: none;
  }
  .companyProfile_devHistory {
    width: 100vw;
    justify-content: start;
  }
  .company_profile{
    width: 100%;
    border-radius: 0;
  }
  ::v-deep .ql-editor img{
    display: none !important;
  }
  ::v-deep .ql-editor .ql-size-large{
    font-size: 1.15rem !important;
  }
}

/* 平板 */
@media (width > 992px) and (width < 1200px) {
  html{
    font-size: 12px;
  }
}

@media (width > 992px) {

}

</style>
